import { Sequelize } from "sequelize";
import config from "./config.js";

const sequelize = new Sequelize({
  host: config.dbConfig.host,
  port: config.dbConfig.port,
  username: config.dbConfig.username,
  password: config.dbConfig.password,
  database: config.dbConfig.database,
  dialect: 'mysql'
})

try {
  await sequelize.authenticate();
  console.log('数据库连接成功！');
} catch (error) {
  console.error('连接失败...', error);
}

export default sequelize